const { resolve } = require("path");

module.exports = {
  lintOnSave: false,
  devServer: {
    disableHostCheck: true,
    host: "127.0.0.1",
    port: 8080,
    proxy: {
      "/api": {
        target: "http://localhost:7001",
        changeOrign: true,
        pathRewrite: {
          "^/api": "",
        },
      },
    },
  },
  productionSourceMap: false,
  pages: {
    login: {
      entry: "src/pages/login/login.js",
      template: "public/login.html",
      filename: "login.html",
      title: "用户管理系统-登录",
    },
    main: {
      entry: "src/pages/main/main.js",
      template: "public/main.html",
      filename: "main.html",
      title: "用户管理系统",
    },
  },
  chainWebpack: (config) => {
    config.resolve.alias
      .set("@login", resolve("src/pages/login"))
      .set("@", resolve("src/pages/main"))
      .set("@assets", resolve("src/pages/main/assets"))
      .set("@util", resolve("src/utils"))
      .set("@mock", resolve("src/mock"))
      .set("@comp", resolve("src/pages/main/components/"))
      .set("@view", resolve("src/pages/main/views/"))
      .set("@opts", resolve("src/pages/main/options/"))
      .set("@consts", resolve("src/pages/main/constant/"));
  },
  configureWebpack: {
    devtool: "source-map",
  },
};
